package com.nut.sp.service.impl;

import com.nut.sp.dao.UserDao;
import com.nut.sp.model.User;
import com.nut.sp.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class UserServiceImpl implements UserService{

    @Autowired
    private UserDao userDao;

    @Override
    public List<User> findAll() {
        return userDao.findAll();
    }

    @Transactional
    @Override
    public void insert(User user) {
        userDao.insert(user);
        throw new RuntimeException("roll");
    }
}
